/*
* Copyright (C) 2008-2009 J-P Nurmi jpnurmi@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
* License for more details.
*
* $Id: ircserverbuffer.cpp 581 2009-05-19 16:40:38Z jpnurmi $
*/

#include "ircserverbuffer.h"
#include "ircbuffer_p.h"
#include "ircsession.h"

namespace Irc
{
    class ServerBufferPrivate : public BufferPrivate
    {
        Q_DECLARE_PUBLIC(ServerBuffer)

    public:
        ServerBufferPrivate();

        QByteArray ident;
        QByteArray nick;
        QByteArray password;
        QByteArray realName;
    };

    ServerBufferPrivate::ServerBufferPrivate() :
        ident(),
        nick(),
        password(),
        realName()
    {
    }

    /*!
        Constructs a new IRC server buffer with \a session as parent.
     */
    ServerBuffer::ServerBuffer(const QByteArray& name, Session* session) : 
        Buffer(name, session, *new ServerBufferPrivate)
    {
    }

    /*!
        Destructs the IRC server buffer.
     */
    ServerBuffer::~ServerBuffer()
    {
    }

    /*!
        Returns the ident.
     */
    QByteArray ServerBuffer::ident() const
    {
        Q_D(const ServerBuffer);
        return d->ident;
    }

    /*!
        Sets the \a ident.
     */
    void ServerBuffer::setIdent(const QByteArray& ident)
    {
        Q_D(ServerBuffer);
        d->ident = ident;
    }

    /*!
        Returns the nick.
     */
    QByteArray ServerBuffer::nick() const
    {
        Q_D(const ServerBuffer);
        return d->nick;
    }

    /*!
        Sets the \a nick.
     */
    void ServerBuffer::setNick(const QByteArray& nick)
    {
        Q_D(ServerBuffer);
        d->nick = nick;
    }

    /*!
        Returns the password.
     */
    QByteArray ServerBuffer::password() const
    {
        Q_D(const ServerBuffer);
        return d->password;
    }

    /*!
        Sets the \a password.

        \note setPassword() has no effect on already established connection.
     */
    void ServerBuffer::setPassword(const QByteArray& password)
    {
        Q_D(ServerBuffer);
        d->password = password;
    }

    /*!
        Returns the real name.
     */
    QByteArray ServerBuffer::realName() const
    {
        Q_D(const ServerBuffer);
        return d->realName;
    }

    /*!
        Sets the real \a name.

        \note setRealName() has no effect on already established connection.
     */
    void ServerBuffer::setRealName(const QByteArray& name)
    {
        Q_D(ServerBuffer);
        d->realName = name;
    }
}

#include "moc_ircserverbuffer.cpp"
